#include <cstdio>
#include <algorithm>
using namespace std;
int main(void){
    int t;
    int n,m;
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&m);
        printf("%d\n",(n+1)*n*(m+1)*m/4);
    }
    return 0;
}